﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///<summary>
///
///</summary>
public class SecondScript : MonoBehaviour {
    [SerializeField]
    private int a;
    [HideInInspector]
    public float b;
    [Range(0, 100)]
    public int c;

    private void Awake()
    {
        //Debug.Log("Awake " + Time.time);
   
    }

    private void Start()
    {
        //Debug.Log("Start " + Time.time);
    }

    private void OnGUI()
    {
        //if (GUILayout.Button("transform"))
        //{
        //    this.transform.position = new Vector3(0, 0, 10);
        //}
        //if (GUILayout.Button("GetComponent"))
        //{
        //    this.GetComponent<MeshRenderer>().material.color = Color.red;
        //}
        //if (GUILayout.Button("GetAllComponents"))
        //{
        //    var allComps = this.GetComponentsInChildren<MeshRenderer>();
        //    foreach(var temp in allComps)
        //    {
        //        temp.material.color = Color.red;
        //    }
        //}
        //if (GUILayout.Button("GetTransform"))
        //{
        //    foreach(Transform temp in this.transform)
        //    {
        //        Debug.Log(temp.name);
        //    }
        //}
        if (GUILayout.Button("GetEnemy"))
        {
            //var allRenderer = FindObjectsOfType<MeshRenderer>();
            var allEnemy = FindObjectsOfType<Enemy>();
            foreach(var enemy in allEnemy)
            {
                Debug.Log(enemy.gameObject.name + " Now Health is " + enemy.health);
            }
        }
        if (GUILayout.Button("GetClarityChild"))
        {
            Transform tempT = TransformHelper.FindClarityTransform(transform, "Cube (4)");
            if (tempT)
            {
                tempT.GetComponent<MeshRenderer>().material.color = Color.red;
            }else
            {
                Debug.Log("No Found");
            }
        }
    }

}
